package edu.friday.controller;

import edu.friday.common.constant.Constants;
import edu.friday.common.result.RestResult;
import edu.friday.common.security.service.SysLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录验证
 */
@RestController
public class SysLoginController {

    @Autowired
    private SysLoginService loginService;

    @PostMapping({"/login", "/"})
    public RestResult login(String username, String password, String uuid) {
        RestResult ajax = RestResult.success();
        // 生成令牌
        String token = loginService.login(username, password, "123", uuid);
        ajax.put(Constants.TOKEN, token);
        return ajax;
    }

}
